package com.styles.codingstyle.services.impl;

import com.styles.codingstyle.dataobject.ObjEntity;
import com.styles.codingstyle.mapper.ObjMapper;
import com.styles.codingstyle.services.ObjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author chenjian
 * @Package
 * @Description:
 * @date 2018/5/23 11:43
 */
@Service
@Transactional
public class ObjServiceImpl implements ObjService {

    public ObjEntity  entity =null;

    @Autowired
    private ObjMapper objMapper;


    @Override
    public ObjEntity findById(Long id) {
        objMapper.findById(id).ifPresent(objEntity -> {
            System.out.println(objEntity.toString());
            entity=objEntity;
        });
        return entity;
    }
}
